using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;

[WebService(Namespace = "http://microsoft.com/webservices/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
    public Service () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod] //[WS-V1] 
    public string WSLogin(string CustomerID)
    {
        NguoiMuaHangDAO kh = new NguoiMuaHangDAO();
        bool kq = kh.th_KiemTraTenDangNhap(CustomerID);
        if(kq == false)
            return "0";
        return CustomerID+""+DateTime.Today.Year.ToString()+""+ DateTime.Now.Hour.ToString() + "" + DateTime.Now.Minute.ToString() + "" + DateTime.Now.Second.ToString();
    }

    [WebMethod] //[WS-V2]
    public DataTable CitiesList()
    {
        
        DataTable dt = new DataTable();
        //DataSet ds = new DataSet();
        ThanhPhoDAO tp = new ThanhPhoDAO();
        //DataSet ds = tp.th_DanhSachThanhPho();
        //dt.Columns.Add("CityID");
        //dt.Columns.Add("CityName");
        //ds.Tables.Add(dt);
        dt = tp.th_DanhSachThanhPho().Tables[0];
        return dt;
    }

    [WebMethod] //[WS-V3] 
    public DataTable Route(string FromCityID, string ToCityID)
    {
        DataTable dt = new DataTable();
        DataSet ds = new DataSet();
        dt.Columns.Add("CityID");
        dt.Columns.Add("OrderNum");
        ds.Tables.Add(dt);

        return dt;
    }

    [WebMethod]//[WS-V4]
    public float RoutePrice(string FromCityID, string ToCityID, string Dimemsion,
        int TransportType)
    {
        return 0;
    }

    [WebMethod] //[WS-V5]
    public string RoutePrice2(string SID, string FromCityID, string ToCityID,
        string Dimemsion, DateTime DayStartTransport)
    {
        return "VC001|500|1/1/2011|5/1/2011|http://theovet.aspx?VCID=VC001";
    }
}
